package strategy;

import strategy.blocker.Blocker;
import strategy.blocker.CallBlocker;
import strategy.blocker.SmsBlocker;
import strategy.mode.BlockMode;

public class Pattern {

    public static void main(String[] args){
        checkAndBlock("18999999999", false, null);
    }

    public static void checkAndBlock(String phoneNumber, boolean isSms, String smsContent) {
        BlockMode currentMode = Utils.getCurrentMode();
        boolean shouldBlock = currentMode.checkAndBlock(phoneNumber);
        if (shouldBlock) {
            block(phoneNumber, isSms, smsContent);
            return;
        }
        notify(phoneNumber, isSms, smsContent);
    }

    public static void notify(String phoneNumber, boolean isSms, String smsContent) {

    }

    public static void block(String phoneNumber, boolean isSms, String smsContent) {
        Blocker blocker = null;
        if (isSms) {
            blocker = new SmsBlocker();
        }else {
            blocker = new CallBlocker();
        }
        blocker.doBlock();
        afterBlock(phoneNumber, isSms, smsContent);
    }

    public static void afterBlock(String phoneNumber, boolean isSms, String smsContent) {
        //  TODO
    }
}
